import { registerMicroApps, start } from 'qiankun'


// pager.subscribe(v => { // 在主应用注册呼机监听器，这里可以监听到其他应用的广播
//   console.log(`监听到子应用${v.from}发来消息：`, v)
//   // store.dispatch('app/setToken', v.token) // 这里处理主应用监听到改变后的逻辑
// })

const useQianKun = () => {
  // const loader = (loading) => {
  //   console.log(loading)
  // }

  registerMicroApps([
    {
      name:'sub-vite-js',
      entry:'//localhost:3010',
      container: '#subapp-container',
      activeRule: '/sub-vite-js'
    },
    {
      name:'sub-vite-ts',
      entry:'//localhost:3020',
      container: '#subapp-container',
      activeRule: '/sub-vite-ts'
    },
    {
      name:'sub-vue-js',
      entry:'//localhost:3030',
      container: '#subapp-container',
      activeRule: '/sub-vue-js'
    }
  ])

  start()
}

export { useQianKun }
